﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LambdaExpression_Demo
{
  class Program
  {
    delegate void DoSomeThing(int a, int b);

    static void Main(string[] args)
    {
      DoSomeThing function;
      function = new DoSomeThing(Add);
      function(2, 3);

      function = Add;
      function(2, 3);

      //using lambda expression
      function = (a, b) =>{
                            Console.WriteLine("A * B = {2}", a, b, a * b);
                          };

      function(2, 3);
      Console.ReadKey();
    }

    static void Add(int a, int b)
    {
      Console.WriteLine("a Add b = {2}", a, b, a + b);
    }
  }
}
